<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('school/index')}">所有学校</a></li>
			<li class="active"><a href="{:url('school/add')}">添加学校</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('school/addPost')}">
			<div class="form-group">
				<label class="col-sm-2 control-label">所属省区<span class="form-required">*</span></label>
				<div class="col-md-6 col-sm-10" >
					<select class="form-control" name="province" id="input-province" >
						<option value="">|--请选择省区--|</option>
						<foreach name="province" item="vo">
							<option value="{$vo.areaId}">{$vo.areaName}</option>
						</foreach>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">所属城市<span class="form-required">*</span></label>
				<div class="col-md-6 col-sm-10" >
					<select class="form-control" id="input-city" name="city" lay-filter="selectSchool">
						<option value="">|--请选择市区--|</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">所属县区<span class="form-required">*</span></label>
				<div class="col-md-6 col-sm-10" >
					<select class="form-control" id="input-area" name="area" lay-filter="selectSchool">
						<option value="">|--请选择县区--|</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label"><span class="form-required">*</span>学校名称:</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" id="name" name="name" class="layui-input">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label"><span class="form-required">*</span>详细地址</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" id="address" name="address" class="layui-input">
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
				</div>
			</div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
<script>
    $(function () {
        $('#input-province').change('change',function () {
            var areaId=$(this).val();
            //alert(schoolId);
            $.ajax({
                url:"{:url('school/getCity')}",
                type:"POST",
                data:{areaId:areaId},
                success:function (res) {
                    $('#input-city').html(res);
                    console.log(res);
                }
            })
        })
    })
</script>
<script>
    $(function () {
        $('#input-city').change('change',function () {
            var cityId=$(this).val();
            $.ajax({
                url:"{:url('school/getArea')}",
                type:"POST",
                data:{cityId:cityId},
                success:function (res) {
                    $('#input-area').html(res);
                    console.log(res);
                }
            })
        })
    })
</script>
</html>